import axios from "axios";

const request = axios.create({
  baseURL: "http://localhost:5173/note",
});

request.interceptors.response.use(
  (response) => {
    if (response.data === 500) {
      throw new Error("Server Error");
    } else {
      return response.data;
    }
  },
  (error) => {
    if (error.response && error.response.status === 404) {
      throw new Error("Not Found");
    }
  }
);

export default request;
